1. Field of the Invention
The present invention relates to an apparatus and method for compressing/decompressing images in a mobile communication terminal, and more particularly to an apparatus and method for compressing or decompressing image data by establishing an optimal threshold.
2. Description of the Related Art
A mobile communication terminal typically requires a large amount of storage memory to perform multimedia functions implemented with a variety of graphic tools, in addition to performing general phone functions. However, as 16-bit images and a large number of content are being widely and rapidly used in the mobile communication terminal, there is a waste of memory in even a common memory with a capacity of 16 MB. An image used in a mobile terminal is classified into a graphic image such as an icon or background and a picture image such as a photo. These images are composed of bitmap images. Each pixel contained in each image is composed of only one unit of data. In particular, there is a high possibility that the same data may be successively arranged in the graphic image, but the picture image is unlikely to contain such successive same data. The graphic image has a plurality of repeating data, such that the waste of memory can be obviated by reducing the size of the data. A representative example for obviating the waste of memory is by reducing a font size contained in a memory's code, that is, the size of graphic data. Preferably, the graphic data should be compressed using a high compression ratio or decompressed using a high decompression speed. However, there is a disadvantage in that a compression algorithm is complicated and a large number of calculations are unavoidably performed to attain such a high compression ratio. A small amount of data is provided on the condition that the graphic data is compressed as the above and stored in a mobile phone, resulting in creating much more storage space in a memory. It takes a long period of time to restore a compressed image to an original image using such a complicated algorithm. A current mobile communication terminal basically displays a color image thereon and needs to display a high-speed image such as a moving image on a large-sized LCD (Liquid Crystal Display). This requires a large number of calculations, such that the decompression speed should not be ignored even though there is enough space available in memory due to the high compression ratio. If the decompression speed is reduced, a variety of functions of a mobile phone, for example, a phone call function, and a data communication function, and so on, may be seriously impaired. Therefore, the decompression speed should be considered an important issue in an image compression process for the mobile communication terminal.
FIG. 1 is an enlarged diagram illustrating an example of one pixel 1 implemented with a bitmap data of a color graphic image of a conventional mobile communication terminal.
Referring to FIG. 1, 16-bit data values for colors contained in the enlarged pixel 1 are shown in the following Table 1.
TABLE 10xda290xfc280xfc280xfc280xfc280xfc280xeba70xba2d0xd86d0xfc280xfc280xfc280xfc280xfc280xcb290xcb290xf8ed0xfc280xfc280xfc280xfc280xfc280xcb290xcb290xf92d0xf8ed0xd8ed0xa8ab0xc9a90xc9690xcb290xed770xf92d0xf92d0xe92d0xc8eb0xcab10xc92d0xfdfb0xfe7d0xf92d0xf92d0xf92d0xd8eb0xcab00xdbb30xec770xfdfb0xf92d0xf92d0xf92d0xd94d0xb8690xfdfb0xfdfb0xfbfb0xf8ed0xf8ed0xf8ed0xd92d0xb8eb0xfdfb0xfdfb0xfdfbReferring to the above Table 1, data “0xfc28” are repeated in a first column, data “0xfc28” and data “0xcb29” are respectively repeated in second and third columns, data “0xf92d” are repeated in fifth and sixth columns, and data “0xf92d” and data “0xfdfb” are respectively repeated in seventh and eighth columns.
FIG. 2A is a diagram illustrating an example of the configuration of a memory adapted to a graphic image compression process for a conventional mobile communication terminal.
Referring to FIG. 2A, a plurality of data of the same color are successively arranged on an uncompressed graphic image 2, such that these same color data are compressed in the form of “the number of repeating times of data + data”, resulting in a compressed graphic image 3 for increasing available space in a memory.
Numerals shown in FIG. 2A designate the number of times the same data is repeated.
FIG. 2B is a diagram illustrating an example of a graphic image compression process of a conventional mobile communication terminal.
The graphic image compression process shown in FIG. 2B is executed using a 256-color image having 8 bits for each pixel. Referring to FIG. 2B, data “0x01” appears once and data “0x00” is repeated seven times in first and second columns of uncompressed data 4. Subsequently, data “0x15” appears once, data “0x10” occurs once, and data “0x15” is subsequently repeated twice in the second column of the uncompressed data 4. Data “0x00” is repeated four times and data “0x3c” is repeated twice in the third column of the uncompressed data 4. Data “0x10” appears once, data “0x20” appears once, data “0x60” is appears once, data “0x70” is appears once, and data “0xff” is repeated twice in the fourth column of the uncompressed data 4. When the uncompressed data 4 repeated as described above it is compressed in the form of “the number of times data is repeated+data”. That is, the uncompressed data 4 is compressed in the form of 0x01, 0x01, 0x07, 0x00, 0x01, 0x15, 0x01, 0x10, 0x02, 0x15, 0x04, 0x00, 0x02, 0x3c, 0x01, 0x10, 0x01, 0x20, 0x01, 0x60, 0x01, 0x70, 0x02, and 0xff. In more detail, as shown in compressed data 5 of FIG. 2b, data “0x01” appears once, data “0x00” is repeated seven times, data “0x15” appears once, data “0x10” appears once, data “0x15” is repeated twice, data “0x 00” is repeated four times, data “0x 3c” is repeated twice, data “0x10” appears once, data “0x20” is appears once, data “0x60” appears once, data “0x70” appears once, and data “0xff” is repeated twice in such a way that the uncompressed data 4 is compressed in the form of data 5, resulting in creating the compressed data 5.
Functions for implementing the aforementioned compression method will hereinafter be described in detail. Specifically, the following software algorithm provides an example of a means for implementing the compression method. It should be noted that parameters for the functions are an address value and a size (denoted by a prescribed unit such as a byte) of an image to be compressed.
byte* image_compress_1(byte * Before_ImagePtr, int ImageSize){static byte Image_buf1[row_max * 2][col_max]; // buffer forstoring a compressed imagebyte* After_ImagePtr = (byte *)Image_buf1 ;byte CompareImapge = *Before_ImagePtr, count =1 ;int i;for(i=0; i <ImageSize ; i++){if(CompareImage == *++Before_ImagePtr){count++;} else {*After_ImagePtr++ = count;*After_ImagePtr++ = CompareImage;CF_size1 += 2; /*Count the number of compressed data to examinea compression ratio*/ /* Set up a new value when the same values are discontinuouslyarranged */count = 1;CompareImage = *Before_ImagePtr;}}return ((byte *)Image_buf1); }
The aforementioned conventional compression algorithm has a high compression ratio when a large number of repeating data occurs. However, as shown in the compressed data 5 of FIG. 2b, the number of data contained in a data group of 0x01, 0x07, 0x10y, 0x01, 0x02, 0x04, 0x01, 0x01, 0x01, and 0x02 is indicative of the number of times repeating data is identical with the number of other data contained in the other data group of 0x01, 0x00, 0x15, 0x10, 0x15, 0x00, 0x3c, 0x10, 0x20, 0x60, 0x70, and 0xff which is indicative of repeating data, such that the uncompressed data 4 is not compressed at all.
In more detail, two data (i.e., the number of repeating times of data+data) may be frequently required in the case of compressing/storing only one unit of data, resulting in an overhead. In this way, the conventional compression method unavoidably increases the amount of data whereas it considerably reduces the number of data according to the type of images.